fix(serve): use CREATE_NO_WINDOW for the Windows background daemon - #786
Merged
Conversation
agentsview serve --background launched the daemon with DETACHED_PROCESS, leaving it without a console. Every console child it later spawns -- notably git, run while resolving a session's repo during sync -- then forces Windows to allocate a fresh, visible console window. This recurs on each re-parse: the file watcher reacting to the active agent's writes, the periodic sync, and the unwatched-directory poll. Launch with CREATE_NO_WINDOW instead. The daemon still runs in the background, but with a hidden console that children inherit, so git/gh no longer pop windows. CREATE_NEW_PROCESS_GROUP is kept to stay isolated from the launching terminal's Ctrl-C.
roborev: Combined Review (
|
The Windows desktop unit job can fail before compilation when crates.io resets a Cargo registry download. Retry only the locked dependency fetch step so transient network failures get another chance, while the actual Rust update tests still run once and surface real failures normally.
The hidden-console daemon behavior depends on a small set of Windows creation flags. Add a Windows-only unit test so future edits do not silently restore DETACHED_PROCESS or drop the process-group isolation flag.
roborev: Combined Review (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows,
agentsview serve --backgroundmakes console windows flash onscreen periodically while the server runs.
Cause
The background daemon is created with
DETACHED_PROCESSincmd/agentsview/serve_background_windows.go, so it has no console of its own.When it later spawns a console child -- most often
git, invoked throughgo.kenn.io/kit/git/cmdwhile resolving a session's repository/branch duringsync -- Windows must allocate a console for that child, and because the parent
has none, the child gets a brand-new visible window. It recurs because parsing
runs whenever the file watcher sees the active agent write a session file, on
the periodic (15-minute) sync, and on the unwatched-directory (2-minute) poll.
The same applies to
ghwhen GitHub outcome metrics are enabled.Fix
Create the daemon with
CREATE_NO_WINDOWinstead ofDETACHED_PROCESS. Thedaemon still detaches into the background, but it now owns a hidden console
that its children inherit, so
git/ghrun without opening visible windows.CREATE_NEW_PROCESS_GROUPis retained so the daemon stays isolated from thelaunching terminal's Ctrl-C, and
terminateProcessis unchanged -- Windowsstill has no POSIX-signal path, so
serve stopkills the process as before.Where to look
cmd/agentsview/serve_background_windows.gois the only file changed.🤖 Generated with Claude Code